package com.pro.util.generator;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public abstract class FileUtil {
	public static void main(String[] args) throws IOException {
//		System.out.println(FileUtil.class.getClassLoader().getResource("").getFile());
//		System.out.println(getName("aaa_bbb_ccc"));
		File file = new File("");
		System.out.println("asd$".replaceAll("d\\$", "b"));
	}
	public static void read(String src) throws IOException{
		FileReader fileReader = new FileReader(new File(src));
		BufferedReader br = new BufferedReader(fileReader);
		String line = null;
		while((line=br.readLine())!=null){
			
		}
	}
	public String readFile(String source){
		return "";
	};
	public static String writeToFile(String desc,String content) throws Exception{
		File file = new File(desc);
		System.out.println(desc);
		if(!file.exists()){
			file.createNewFile();
		}
		FileWriter fw = new FileWriter(file);
		fw.write(content);
		fw.flush();
		fw.close();
		return "";
	}
//	public abstract void setFileReader(FileReader fileReader);
//	public abstract String callback();
	public static String getName(String s){
		String[] a = s.split("_");
		StringBuffer sb = new StringBuffer();
		for(String cs:a){
			sb.append(getUpString(cs));
		}
		return  sb.toString();
	}
	public static String getUpString(String s){
		char c = s.charAt(0);
		char d = (char)(c-32);
		String b = s.substring(1, s.length());
		s = d+b;
		return s;
	}
}
